package testUnit;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import classes_metier.CarteGraphique;
import classes_metier.DisqueDur;


import blueJ.*;

public class OrdinateurTest2{
	private Ordinateur pc;
	private Composant c1, c2;
	
	@Before
    public void setUp(){
    	pc = new Ordinateur("Asus", "Tartempion");
    	c1 = new CarteGraphique("NVidia");
    	c2 = new DisqueDur("Seagate", 500);
    }
    @Test
    public void testAjouterComposant(){
    	assertTrue(pc.ajouterComposant(c1));
    	assertTrue(pc.ajouterComposant(c2));
    }   
    @Test
    public void testEnleverComposant(){
    	assertFalse(pc.enleverComposant(c1));
    }    
    @Test
    public void testGetComposant(){
    	pc.ajouterComposant(c1);
    	assertEquals(pc.getComposant(c1.getIdentite()), c1);
    }
}
